using UnityEngine;

namespace Emerald4
{
    /// <summary>
    /// Example: How to register a tablet app in one line!
    /// Attach this to any GameObject, assign your icon and prefab, done.
    /// </summary>
    public class TabletAppExample : MonoBehaviour
    {
        [Header("Your App")]
        [Tooltip("Title shown on the tablet button")]
        public string appTitle = "My Custom App";
        
        [Tooltip("Icon shown on the tablet button")]
        public Sprite appIcon;
        
        [Tooltip("Your app's UI prefab (a Canvas with your UI)")]
        public GameObject appPrefab;
        
        [Tooltip("Auto-resize tablet when app opens (recommended)")]
        public bool autoResize = true;

        private void Start()
        {
            // That's it! One line to register your app.
            TabletAppRegistry.Register(appTitle, appIcon, appPrefab, autoResize);
        }

        private void OnDestroy()
        {
            // Optional: Unregister when this object is destroyed
            TabletAppRegistry.Unregister(appTitle);
        }
    }
}
